package com.leimo.demo.future;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class FutureTest {

  public static void main(String[] args) throws ExecutionException, InterruptedException {
    CumtomCompleteFuture cumtomCompleteFuture = new CumtomCompleteFuture();
    Executors.newScheduledThreadPool(2).schedule(()-> {
      cumtomCompleteFuture.received("Hello World");
    }, 2, TimeUnit.SECONDS);
    String s = cumtomCompleteFuture.get();
    System.out.println(s);
  }
}
